package com.ruoyi.project.jiaqin.advertcooperate.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.advertcooperate.domain.JiaqinAdvertCooperate;
import com.ruoyi.project.jiaqin.advertcooperate.mapper.JiaqinAdvertCooperateMapper;
import com.ruoyi.project.jiaqin.advertcooperate.service.IJiaqinAdvertCooperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 广告合作类型Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-27
 */
@Service
public class JiaqinAdvertCooperateServiceImpl implements IJiaqinAdvertCooperateService 
{
    @Autowired
    private JiaqinAdvertCooperateMapper jiaqinAdvertCooperateMapper;

    /**
     * 查询广告合作类型
     * 
     * @param id 广告合作类型ID
     * @return 广告合作类型
     */
    @Override
    public JiaqinAdvertCooperate selectJiaqinAdvertCooperateById(String id)
    {
        return jiaqinAdvertCooperateMapper.selectJiaqinAdvertCooperateById(id);
    }

    /**
     * 查询广告合作类型列表
     * 
     * @param jiaqinAdvertCooperate 广告合作类型
     * @return 广告合作类型
     */
    @Override
    public List<JiaqinAdvertCooperate> selectJiaqinAdvertCooperateList(JiaqinAdvertCooperate jiaqinAdvertCooperate)
    {
        return jiaqinAdvertCooperateMapper.selectJiaqinAdvertCooperateList(jiaqinAdvertCooperate);
    }

    /**
     * 新增广告合作类型
     * 
     * @param jiaqinAdvertCooperate 广告合作类型
     * @return 结果
     */
    @Override
    public int insertJiaqinAdvertCooperate(JiaqinAdvertCooperate jiaqinAdvertCooperate)
    {
        jiaqinAdvertCooperate.setId(UUID.randomUUID().toString().replace("-",""));
        jiaqinAdvertCooperate.setCreatedTime(new Date());
        return jiaqinAdvertCooperateMapper.insertJiaqinAdvertCooperate(jiaqinAdvertCooperate);
    }

    /**
     * 修改广告合作类型
     * 
     * @param jiaqinAdvertCooperate 广告合作类型
     * @return 结果
     */
    @Override
    public int updateJiaqinAdvertCooperate(JiaqinAdvertCooperate jiaqinAdvertCooperate)
    {
        return jiaqinAdvertCooperateMapper.updateJiaqinAdvertCooperate(jiaqinAdvertCooperate);
    }

    /**
     * 删除广告合作类型对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteJiaqinAdvertCooperateByIds(String ids)
    {
        return jiaqinAdvertCooperateMapper.deleteJiaqinAdvertCooperateByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除广告合作类型信息
     * 
     * @param id 广告合作类型ID
     * @return 结果
     */
    @Override
    public int deleteJiaqinAdvertCooperateById(String id)
    {
        return jiaqinAdvertCooperateMapper.deleteJiaqinAdvertCooperateById(id);
    }

    @Override
    public List<JiaqinAdvertCooperate> findAdvertCooperateList() {
        return jiaqinAdvertCooperateMapper.findAdvertCooperateList();
    }
}
